import csv
from flask import Flask, request

server = Flask('new')

data_path = 'data.csv'

@server.route('/info')
def get_info():
    url_id = request.args.get('id')

    data_file = open(data_path,'r',encoding='utf-8')
    data_fin = csv.reader(data_file)

    for a in data_fin:
        if a[0] == url_id:
            return{
                "name": a[1],
                "sex": a[2],
                "intro": a[3],
                "about": a[4]
            }

    return {
        "name": None,
        "sex": None,
        "intro": None,
        "about": None
        }
        
server.run('127.0.0.1', port=8080)